import Vue from 'vue'
import Router from 'vue-router'
import routes from '@/router/config'
import vueTitle from '../units/vueTitle'

Vue.use(Router)

const router= new Router({
  mode: 'history',
  routes: routes
})
router.beforeEach(function(to,from,next){
  let matched=to.matched
  let title=(matched.length>1?matched[1].meta.title:'')||matched[0].meta.title
  vueTitle(title)
  next();
})
export default router;